﻿using Microsoft.AspNetCore.Mvc;
using Zhp.Api.Attributes;
using Zhp.IService.Monitor;
using Zhp.Model.Common;
using Zhp.Model.Monitor;

namespace Zhp.Api.Controllers.Monitor
{

    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiGroup(GroupName = ApiGroupEnum.Monitor)]
    [SeedMenu(MenuGroup = ApiGroupEnum.Monitor, Name = "审计日志", Order = 6, RouterName = "auditLog", WebFilePath = "monitor/auditLog/index", Icon = "log")]
    public class AuditLogController : ControllerBase
    {
        protected readonly IAuditLogService _auditLogSvc;
        public AuditLogController(IAuditLogService auditLogSvc)
        {
            _auditLogSvc = auditLogSvc;
        }

        [NotAuditLog]
        [SeedList("审计日志列表", "审计日志", ApiGroupEnum.Monitor)]
        [HttpPost]
        public async Task<PageRet<AuditLogModel>> Index(AuditLogQuery query)
        {
            var list = await _auditLogSvc.GetAuditLog(query);

            return new PageRet<AuditLogModel>
            {
                DataList = list,
                TotalCount = query.TotalCount,
            };
        }
    }
}
